package org.cliff.message.platform.demo.config;

import org.cliff.message.platform.management.domain.MPR;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 演示项目全局异常处理
 * 
 * @author 刘文
 * @date 2023/11/2
 */
@RestControllerAdvice
@Slf4j
public class DemoGlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public MPR<Void> handleException(Exception exception) {
        log.warn("Message platform business aborted for: {}", exception.getMessage());
        return MPR.failed(1024, exception.getMessage());
    }
}
